package com.yc.dygang.web;

import com.google.gson.Gson;
import com.yc.dygang.dao.MovieDao;
import com.yc.dygang.util.Util;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "GetMovieServlet", value = "/GetMovieServlet")
public class GetMovieServlet extends HttpServlet {

    private MovieDao movieDao = new MovieDao();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        Map<String, Object> movie = movieDao.selectById(id);
        Util.toJson(movie,response);

    }

}
